package de.baumann.browser.adapter;

import android.support.annotation.Nullable;
import android.widget.ImageView;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

import de.baumann.browser.R;
import de.baumann.browser.api.net.vo.MiningIncome;

public class MiningIncomeAdapter extends BaseQuickAdapter<MiningIncome, BaseViewHolder> {
    public MiningIncomeAdapter() {
        super(R.layout.item_miningincome);
    }

    @Override
    protected void convert(BaseViewHolder helper, MiningIncome item) {
        ImageView icon = helper.getView(R.id.ivmiIcon);
        TextView title = helper.getView(R.id.tvmiTitle);
        TextView time = helper.getView(R.id.tvmiTime);
        TextView amount = helper.getView(R.id.tvmiAmount);
        if ("power".equals(item.getDealType())) {
            icon.setImageResource(R.drawable.suanlishouyi);
            title.setText("挖矿算力收益");
            amount.setText("+"+item.getValue()+" 算力");
            amount.setTextColor(mContext.getResources().getColor(R.color.blue_3A81F6));
        } else {
            icon.setImageResource(R.drawable.wakuang_icon);
            title.setText("挖矿ODIN收益");
            amount.setText("+"+item.getValue()+" ODIN");
            amount.setTextColor(mContext.getResources().getColor(R.color.color_FF8D06));
        }
        time.setText(item.getCreateTime());
    }
}
